package leetcodecompetition.D348;

/**
 * @Author: Siantar
 * @Date: 2023-06-04-10:41
 * @Description: 1.0
 */
public class T6424 {
    public int semiOrderedPermutation(int[] nums) {
        int n = nums.length;
        int left = 0, right = n - 1;
        for (int i = 0; i < n; i++) {
            if (nums[i] == 1) left = i;
            if (nums[i] == n) right = i;
        }
        System.out.println(left+" "+right);
        return left + (n - 1 - right) - left > right ? 1 : 0;
    }
}
